package pe.edu.unmsm.fiee.sispagos.integracion.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import pe.edu.unmsm.fiee.sispagos.integracion.dao.ConceptoPagoDAO;
import pe.edu.unmsm.fiee.sispagos.negocio.modelo.ConceptoPagoDTO;

@Repository
public class ConceptoPagoDAOImpl extends SqlMapClientDaoSupport implements ConceptoPagoDAO {

	@Autowired
	public ConceptoPagoDAOImpl(SqlMapClient sql) {
		super.setSqlMapClient(sql);
	}

	@Override
	public List<ConceptoPagoDTO> selectCptoslikeNombre(String query) {
		return (List<ConceptoPagoDTO>)getSqlMapClientTemplate().queryForList("ConceptoPago.selectCptoslikeNombre", "%"+query+"%");
	}

	@Override
	public void insertConceptoPago(ConceptoPagoDTO cptoEditar) {
		getSqlMapClientTemplate().insert("ConceptoPago.insertConceptoPago", cptoEditar);
	}

	@Override
	public ConceptoPagoDTO selectCptoPagoxCodigo(String codigoConceptoPago) {
		return (ConceptoPagoDTO)getSqlMapClientTemplate().queryForObject("ConceptoPago.selectCptoPagoxCodigo", codigoConceptoPago);
	}

	@Override
	public void updateConceptoPago(ConceptoPagoDTO cptoEditar) {
		getSqlMapClientTemplate().update("ConceptoPago.updateConceptoPago", cptoEditar);
	}

}
